using System;
using System.Collections.Generic;
using System.Text;
using Wrath.Xml;
using System.ComponentModel;
using Wrath.RuleForge.Interfaces;

namespace Wrath.RuleForge.Property
{
    public class TemplateWrapper : IPropertyWrapper<Element>
    {
        private Element element;
        private bool hasChanged = false;

        private Wrath.Xml.Attribute nameAttribute;

        [Category("Template")]
        [Description("The template name.")]
        public string Name
        {
            get { return nameAttribute.Value; }
            set { nameAttribute.Value = value; }
        }

        public TemplateWrapper(Element element)
        {
            this.element = element;

            nameAttribute = element.FindAttribute("name");
        }

        #region IPropertyWrapper<Element> Members

        [Browsable(false)]
        public bool HasChanged
        {
            get
            {
                return hasChanged;
            }
            set
            {
                hasChanged = value;
            }
        }

        [Browsable(false)]
        public Element Data
        {
            get { return element; }
        }

        #endregion
    }
}
